<?php

use yii\db\Migration;

/**
 * Handles the creation of table `orders`.
 */
class m161111_014509_create_order_table extends Migration
{
    /**
     * @inheritdoc
     */
    public function up()
    {
        $this->createTable('orders', [
            'id' => $this->primaryKey(),
            'mid'=>$this->integer(),
            'memname'=> $this->string(),
            'memphone'=> $this->string(),
            'name'=> $this->string(),
            'ordersn'=> $this->string()->unique(),
            'paytime' =>$this->integer(),
            'num' =>$this->integer(),
            'payway' =>$this->string(),
            'paymoney'=> $this->string(),
            'realmoney'=> $this->string(),
            'invoicemoney' => $this->string(),
            'isinvoice' => $this->integer(),
            'starttime' => $this->integer(),
            'endtime' => $this->integer(),
            'paycategory' =>$this->string(),
            'status' => $this->smallInteger()->notNull()->defaultValue(1),
            'created_at' => $this->integer()->notNull(),
            'updated_at' => $this->integer()->notNull(),     
        
        ]);
    }

    /**
     * @inheritdoc
     */
    public function down()
    {
        $this->dropTable('orders');
    }
}
